package com.lu.jdog.util;

import java.io.File;
import java.io.InputStream;
import java.net.URL;

public class Resource {
    public static String getAssertPath(Class<?> cls) {
        String packName = cls.getPackage().getName();
        return packName.replace('.', File.separatorChar);
    }

    public static String getAssertPath(Class<?> cls, String name) {
        return getAssertPath(cls) + File.separator + name;
    }

    public static URL getAssetURl(String name) {
        return ClassLoader.getSystemResource(name);
    }

    public static InputStream getAssetStream(String name) {
        return ClassLoader.getSystemResourceAsStream(name);
    }

    public static URL getAssetURL(Class<?> clss, String name) {
        return clss.getResource(name);
    }

    public static InputStream getAssetStream(Class<?> clss, String name) {
        return clss.getResourceAsStream(name);
    }

}
